package com.shierke.Ume.ui.activity.explore

import android.content.Context
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.shierke.Ume.R
import com.shierke.Ume.base.BaseActivity
import com.shierke.Ume.base.BaseNoTitleActivity
import com.shierke.Ume.ui.adapter.explore.SearchResultHeadAdapter
import com.shierke.Ume.ui.adapter.explore.SearchResultListAdapter
import com.shierke.Ume.util.startActivity
import kotlinx.android.synthetic.main.activity_search_result.*

/**
 * Create by Ybx
 * on 2020-10-15
 * Desribe:
 */
class SearchResultActivity : BaseNoTitleActivity() {


    companion object {
        fun startActivity(context: Context) {
            context.startActivity<SearchResultActivity>()
        }
    }


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_search_result)


        val linearLayoutManager = LinearLayoutManager(this)

        linearLayoutManager.orientation = LinearLayoutManager.HORIZONTAL

        val searchResultHeadAdapter = SearchResultHeadAdapter()
        pRecycle.apply {
            adapter = searchResultHeadAdapter
            layoutManager = linearLayoutManager
        }


        val staggeredGridLayoutManager = object :
            StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL) {
            override fun canScrollVertically(): Boolean {
                return false
            }
        }

        val searchResultListAdapter = SearchResultListAdapter()

        recycle.apply {
            layoutManager = staggeredGridLayoutManager
            adapter = searchResultListAdapter
        }


    }


}